<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('订单列表')"/>
</head>
<body class="gray-bg">
<div class="container-div">

    <div class="row">
        <!-- 搜索栏 -->
        <div class="col-sm-12 search-collapse">
            <form id="role-form">
                <div class="select-list">
                    <ul>
                        <li>
                            项目名称：<input type="text" name="projectInfo.projectName"/>
                        </li>
                        <li>
                            客户信息：<input type="text" name="customer.cname"/>
                        </li>
                        <li>
                            销售人员：<input type="text" name="saleName"/>
                        </li>
                        <li>
                            <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i
                                    class="fa fa-search"></i>&nbsp;搜索</a>
                            <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i
                                    class="fa fa-refresh"></i>&nbsp;重置</a>
                        </li>
                    </ul>
                </div>
            </form>
        </div>

       <!-- &lt;!&ndash; 头工具栏 &ndash;&gt;
        <div class="btn-group-sm" id="toolbar" role="group">
            <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="system:role:add">
                <i class="fa fa-plus"></i> 新增
            </a>
            <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()"
               shiro:hasPermission="system:role:remove">
                <i class="fa fa-remove"></i> 删除
            </a>
        </div>-->

        <!-- 数据网格 -->
        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-table"></table>
        </div>
    </div>
</div>
<th:block th:include="include :: footer"/>
<script th:inline="javascript">
    var editFlag = [[${@permission.hasPermi('system:role:edit')}]];
    var detailFlag = [[${@permission.hasPermi('monitor:job:detail')}]];
    var prefix = ctx + "cms/sa/order";

    $(function () {
        var options = {
            url: prefix + "/list",
            createUrl: prefix + "/add",
            removeUrl: prefix + "/remove",
            updateUrl: prefix + "/edit/{id}",
            detailUrl: prefix + "/detail/{id}",
            sortName: "orderId",
            modalName: "订单",
            columns: [
                {
                    checkbox: true
                },
                {
                    field: 'orderId',
                    title: '订单编号'
                },
                {
                    field: 'projectInfo.projectName',
                    title: '项目名称',
                },
                {
                    field: 'customer.cname',
                    title: '客户信息',
                },
                {
                    field: 'productLists[0].productSum',
                    title: '项目总额',
                },
                {
                    field: 'deliver',
                    title: '配送方式',
                },
                {
                    field: 'saleName',
                    title: '销售人员',
                },
                {
                    field: 'managerName',
                    title: '部门负责人',
                },
                {
                    field: 'orderDate',
                    title: '创建时间',
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function (value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.orderId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                        actions.push('<a class="btn btn-warning btn-xs ' + detailFlag + '" href="javascript:void(0)" onclick="$.operate.detail(\'' + row.orderId + '\')"><i class="fa fa-search"></i>查看</a> ');
                        return actions.join('');
                    }
                }
            ]
        };
        $.table.init(options);
    });

</script>
</body>
</html>